<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>REM Example</title>

  <style>
    html {
      font-size: 16px; /* 设置根元素字体大小为16px，此时1rem = 16px */
    }
   .box {
      width: 10rem; /* 宽度为10rem，根据根元素字体大小计算实际宽度 */
      height: 5rem;
      background-color: lightblue;
    }
  </style>

</head>

<body>
  <div class="box"></div>

</body>

</html>
